package exammanager;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.geom.RoundRectangle2D;

import javax.swing.BorderFactory;
import javax.swing.JList;
import javax.swing.ListModel;

import structure.Exam;

public class GUIExamJList extends JList<Exam>{
	private static final long serialVersionUID = 1L;

	public GUIExamJList(ListModel<Exam> model) {
		super(model);
		setOpaque(false);
		setBorder(BorderFactory.createEmptyBorder());
	}

	@Override
	protected void paintComponent(Graphics g) {
		Graphics2D g2d;
		g2d = (Graphics2D) g;
		
		g2d.setRenderingHint(
			    RenderingHints.KEY_ANTIALIASING,
			    RenderingHints.VALUE_ANTIALIAS_ON);
		
		RoundRectangle2D roundedRectangle = new RoundRectangle2D.Float(0, 0, this.getWidth()-1, this.getHeight()-1, 15, 15);
		
		g2d.setColor(new Color(250, 250, 250, 255));
		g2d.fill(roundedRectangle);
		
		g2d.setColor(new Color(100, 100, 100, 150));
		g2d.draw(roundedRectangle);
		g2d.setRenderingHint(
			    RenderingHints.KEY_ANTIALIASING,
			    RenderingHints.VALUE_ANTIALIAS_DEFAULT);
		super.paintComponent(g);
	}

}
